package com.web.hilover.service.impl;

import com.web.hilover.entity.Comment;
import com.web.hilover.mapper.CommentMapper;
import com.web.hilover.service.CommentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
@Slf4j
public class CommentServiceImpl implements CommentService {
    
    @Autowired
    private CommentMapper commentMapper;
    
    @Override
    public List<Comment> getCommentsByCouple(Long coupleId) {
        return commentMapper.findByCouple(coupleId);
    }
    
    @Override
    public List<Map<String, Object>> getAllCommentsWithDetail() {
        return commentMapper.findAllWithDetail();
    }
    
    @Override
    public void addComment(Comment comment) {
        commentMapper.insert(comment);
    }
    
    @Override
    public void deleteComment(Long id) {
        commentMapper.deleteById(id);
    }
    
    @Override
    public void likeComment(Long id) {
        commentMapper.incrementLikes(id);
    }
    
    @Override
    public List<Map<String, Object>> getCommentsByUser(Long userId) {
        return commentMapper.findByUserWithDetail(userId);
    }
} 